import Vue from 'vue'
import App from './App'
import router from './router'
import VRouter from  'vue-router'
import Vuex from 'vuex'
import Apple from './components/apple'
import Banana from './components/banana'
import RedApple from './components/redapple'
Vue.use(VRouter)
Vue.use(Vuex)

let store = new Vuex.Store({
  state:{
    totalPrice:0
  },
  mutations:{
    increment(state,price){
      state.totalPrice += price
    },
    decrement(state,price){
      state.totalPrice -= price
    }
  }
})
let router = new VRouter({
  mode:'history',
  router:[
    {
      path:'/',
      redirect:'/apple'
    },
    {
      path:'/apple',
      components:Apple,
      name:'applePalge',
      children:[
        {
          path:'red',
          component:RedApple
        }
      ]
    },
    {
      path:'/banana',
      component:Banana
    }
  ]
})
//Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
